import 'package:FiduMart/generated/json/base/json_convert_content.dart';
import 'package:FiduMart/core/network/model/mining_info_entity.dart';

MiningInfoEntity $MiningInfoEntityFromJson(Map<String, dynamic> json) {
  final MiningInfoEntity miningInfoEntity = MiningInfoEntity();
  final String? id = jsonConvert.convert<String>(json['id']);
  if (id != null) {
    miningInfoEntity.id = id;
  }
  final String? nameZh = jsonConvert.convert<String>(json['nameZh']);
  if (nameZh != null) {
    miningInfoEntity.nameZh = nameZh;
  }
  final String? nameEn = jsonConvert.convert<String>(json['nameEn']);
  if (nameEn != null) {
    miningInfoEntity.nameEn = nameEn;
  }
  final String? nameTh = jsonConvert.convert<String>(json['nameTh']);
  if (nameTh != null) {
    miningInfoEntity.nameTh = nameTh;
  }
  final int? miningType = jsonConvert.convert<int>(json['miningType']);
  if (miningType != null) {
    miningInfoEntity.miningType = miningType;
  }
  final String? coverUrl = jsonConvert.convert<String>(json['coverUrl']);
  if (coverUrl != null) {
    miningInfoEntity.coverUrl = coverUrl;
  }
  final int? cycle = jsonConvert.convert<int>(json['cycle']);
  if (cycle != null) {
    miningInfoEntity.cycle = cycle;
  }
  final String? rate = jsonConvert.convert<String>(json['rate']);
  if (rate != null) {
    miningInfoEntity.rate = rate;
  }
  final int? min = jsonConvert.convert<int>(json['min']);
  if (min != null) {
    miningInfoEntity.min = min;
  }
  final int? max = jsonConvert.convert<int>(json['max']);
  if (max != null) {
    miningInfoEntity.max = max;
  }
  final int? oneMax = jsonConvert.convert<int>(json['oneMax']);
  if (oneMax != null) {
    miningInfoEntity.oneMax = oneMax;
  }
  final int? purchased = jsonConvert.convert<int>(json['purchased']);
  if (purchased != null) {
    miningInfoEntity.purchased = purchased;
  }
  final String? drnToToolRate = jsonConvert.convert<String>(
      json['drnToToolRate']);
  if (drnToToolRate != null) {
    miningInfoEntity.drnToToolRate = drnToToolRate;
  }
  final int? startTime = jsonConvert.convert<int>(json['startTime']);
  if (startTime != null) {
    miningInfoEntity.startTime = startTime;
  }
  final int? endTime = jsonConvert.convert<int>(json['endTime']);
  if (endTime != null) {
    miningInfoEntity.endTime = endTime;
  }
  final int? state = jsonConvert.convert<int>(json['state']);
  if (state != null) {
    miningInfoEntity.state = state;
  }
  final int? buyNeedInvite = jsonConvert.convert<int>(json['buyNeedInvite']);
  if (buyNeedInvite != null) {
    miningInfoEntity.buyNeedInvite = buyNeedInvite;
  }
  final int? inviteCount = jsonConvert.convert<int>(json['inviteCount']);
  if (inviteCount != null) {
    miningInfoEntity.inviteCount = inviteCount;
  }
  final int? totalInviteCount = jsonConvert.convert<int>(
      json['totalInviteCount']);
  if (totalInviteCount != null) {
    miningInfoEntity.totalInviteCount = totalInviteCount;
  }
  final int? totalInvestLimit = jsonConvert.convert<int>(
      json['totalInvestLimit']);
  if (totalInvestLimit != null) {
    miningInfoEntity.totalInvestLimit = totalInvestLimit;
  }
  final int? totalInvestNum = jsonConvert.convert<int>(json['totalInvestNum']);
  if (totalInvestNum != null) {
    miningInfoEntity.totalInvestNum = totalInvestNum;
  }
  final int? returnType = jsonConvert.convert<int>(json['returnType']);
  if (returnType != null) {
    miningInfoEntity.returnType = returnType;
  }
  final int? isTrial = jsonConvert.convert<int>(json['isTrial']);
  if (isTrial != null) {
    miningInfoEntity.isTrial = isTrial;
  }
  final int? trialQualification = jsonConvert.convert<int>(
      json['trialQualification']);
  if (trialQualification != null) {
    miningInfoEntity.trialQualification = trialQualification;
  }
  return miningInfoEntity;
}

Map<String, dynamic> $MiningInfoEntityToJson(MiningInfoEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['id'] = entity.id;
  data['nameZh'] = entity.nameZh;
  data['nameEn'] = entity.nameEn;
  data['nameTh'] = entity.nameTh;
  data['miningType'] = entity.miningType;
  data['coverUrl'] = entity.coverUrl;
  data['cycle'] = entity.cycle;
  data['rate'] = entity.rate;
  data['min'] = entity.min;
  data['max'] = entity.max;
  data['oneMax'] = entity.oneMax;
  data['purchased'] = entity.purchased;
  data['drnToToolRate'] = entity.drnToToolRate;
  data['startTime'] = entity.startTime;
  data['endTime'] = entity.endTime;
  data['state'] = entity.state;
  data['buyNeedInvite'] = entity.buyNeedInvite;
  data['inviteCount'] = entity.inviteCount;
  data['totalInviteCount'] = entity.totalInviteCount;
  data['totalInvestLimit'] = entity.totalInvestLimit;
  data['totalInvestNum'] = entity.totalInvestNum;
  data['returnType'] = entity.returnType;
  data['isTrial'] = entity.isTrial;
  data['trialQualification'] = entity.trialQualification;
  return data;
}

extension MiningInfoEntityExt on MiningInfoEntity {
  MiningInfoEntity copyWith({
    String? id,
    String? nameZh,
    String? nameEn,
    String? nameTh,
    int? miningType,
    String? coverUrl,
    int? cycle,
    String? rate,
    int? min,
    int? max,
    int? oneMax,
    int? purchased,
    String? drnToToolRate,
    int? startTime,
    int? endTime,
    int? state,
    int? buyNeedInvite,
    int? inviteCount,
    int? totalInviteCount,
    int? totalInvestLimit,
    int? totalInvestNum,
    int? returnType,
    int? isTrial,
    int? trialQualification,
  }) {
    return MiningInfoEntity()
      ..id = id ?? this.id
      ..nameZh = nameZh ?? this.nameZh
      ..nameEn = nameEn ?? this.nameEn
      ..nameTh = nameTh ?? this.nameTh
      ..miningType = miningType ?? this.miningType
      ..coverUrl = coverUrl ?? this.coverUrl
      ..cycle = cycle ?? this.cycle
      ..rate = rate ?? this.rate
      ..min = min ?? this.min
      ..max = max ?? this.max
      ..oneMax = oneMax ?? this.oneMax
      ..purchased = purchased ?? this.purchased
      ..drnToToolRate = drnToToolRate ?? this.drnToToolRate
      ..startTime = startTime ?? this.startTime
      ..endTime = endTime ?? this.endTime
      ..state = state ?? this.state
      ..buyNeedInvite = buyNeedInvite ?? this.buyNeedInvite
      ..inviteCount = inviteCount ?? this.inviteCount
      ..totalInviteCount = totalInviteCount ?? this.totalInviteCount
      ..totalInvestLimit = totalInvestLimit ?? this.totalInvestLimit
      ..totalInvestNum = totalInvestNum ?? this.totalInvestNum
      ..returnType = returnType ?? this.returnType
      ..isTrial = isTrial ?? this.isTrial
      ..trialQualification = trialQualification ?? this.trialQualification;
  }
}